package com.bo.ioc.controller;

import com.bo.ioc.model.Lists;
import com.bo.ioc.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/yaml")
@RestController
public class YamlController {
    @Value("${server.port}")
    public Integer number;
    @Value("${spring.datasource.url}")
    public String url;
    @Value("${spring.datasource.username}")
    public String username;
    @Value("${spring.datasource.password}")
    public String password;
    @Value("${String.str4}")
    public String str4;
    @Value("${String.str5}")
    public String str5;
    @Value("${String.str6}")
    public String str6;
    @RequestMapping("/run1")
    public void run1(){
        System.out.println(number);
        System.out.println(url);
        System.out.println(username);
        System.out.println(password);
    }
    @RequestMapping("/run2")
    public String run2(){
        return number + "\n" + url + "\n" + username + "\n" + password;
    }
    @RequestMapping("/run3")
    public void run3(){
        System.out.println(str4);
        System.out.println(str5);
        System.out.println(str6);
    }
    public Student student;
    public Lists lists;
    @Autowired
    public YamlController(Student student,Lists lists){
        this.student = student;
        this.lists = lists;
    }
    public void run4(){
        System.out.println(student);
    }

    public void run5(){
        System.out.println(lists.getName());
        System.out.println(lists.getMap());
    }


}
